﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using EbbinghausWord.Entities;

namespace EbbinghausWord.Controls
{
    public partial class WordListControl : UserControl
    {
        public WordListControl()
        {
            InitializeComponent();
        }

        #region public property
        /// <summary>
        /// 将要显示的单词列表
        /// </summary>

        private List<WordEntity> _wordList;

        public List<WordEntity> WordList
        {
            get { return _wordList; }
            set
            {
                _wordList = value;
                if (_wordList == null)
                {
                    totalTextBlock.Text = "共 0 个";
                    return;
                }
                totalTextBlock.Text = string.Format("共 {0} 个", _wordList.Count);
                wordListBox.ItemsSource = _wordList;
            }
        }


        #endregion

        #region callback
        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            if (_wordList == null)
            {
                totalTextBlock.Text = "共 0 个";
                return;
            }
        }

        #endregion
    }
}
